-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up image editor REST route. #23368
Clean up image editor REST route. #23368
Conversation
- Changes the route to `image-editor`. - Returns proper translated errors with status codes. - On success, returns the new media item's full response. - Updates apiFetch call to use `data` instead of manually constructing the JSON body.
@@ -44,22 +44,22 @@ public function register_routes() { | |||
'permission_callback' => array( $this, 'permission_callback' ), | |||
'args' => array( | |||
'x' => array( | |||
'type' => 'float', | |||
'type' => 'number', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange, using number
failed for me before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, it seems to work, but what happens then? Is it rounded? Ideally we accept float values here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A float
is referred to as a number
in JSON Schema, https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.4.2.1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More accurate link ( its the v4 spec which we use ) https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
@@ -44,22 +44,22 @@ public function register_routes() { | |||
'permission_callback' => array( $this, 'permission_callback' ), | |||
'args' => array( | |||
'x' => array( | |||
'type' => 'float', | |||
'type' => 'number', | |||
'minimum' => 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it also possible to specify a maximum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep we can use the maximum
property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't mean to do some of the same changes in #23369. We'll get your stuff merged and I can adjust. Everything was working when I pulled this down and tried it out. 👍
Description
image-editor
.data
instead of manually constructing the JSON body.How has this been tested?
Manually tested editing an image.
Checklist: